﻿/*
* @autor: hectorea
* @date: 01/08/2012
* @programming interview 12
*/
using System;
using System.Text;

namespace SumDigitsOfANumber
{
    /// <summary>
    /// Programming Interview 12: Write a method to calculate the sum of the digits of a given number
    /// </summary>
    class Program
    {
        static void Main(string[] args)
        {
            do
            {
                Console.Clear();

                StringBuilder sb = new StringBuilder();
                sb.Append("Please type an integer number: ");

                Console.Write(sb.ToString());

                int number = int.Parse(Console.ReadLine());

                Console.Write("The sum of the digits of hte number of {0} is: {1}", number, number.SumDigits());

                Console.WriteLine();
                Console.WriteLine("Please type any key to continue testing or [X] to exit");

            } while (!Console.ReadLine().ToUpper().Equals("X"));
        }
    }
}
